package com.zyz.bookborrowing.utils;
/*
 * 数据库的工具类
 */

import com.mysql.cj.jdbc.MysqlDataSource;
import org.apache.commons.dbutils.QueryRunner;

public class MyDButils {

    private static MysqlDataSource dataSource;

    static {
        dataSource = new MysqlDataSource();
        dataSource.setUser("root");
        dataSource.setPassword("123456");
        dataSource.setUrl("jdbc:mysql://localhost:3306/books_borrowing?serverTimezone=Asia/Shanghai&useTimezone=true&characterEncoding=utf-8");
        // jdbc:mysql://localhost/books_borrowing?&useUnicode=true&characterEncoding=utf-8
    }

    public static QueryRunner getQueryRunner() {
        return new QueryRunner(dataSource);
    }
}
